<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Request an interactive shell</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ssh2-shell" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ssh2_shell</h1>
  <p class="verinfo">(PECL ssh2 &gt;= 0.9.0)</p><p class="refpurpose"><span class="refname">ssh2_shell</span> &mdash; <span class="dc-title">Request an interactive shell</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ssh2-shell-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ssh2_shell</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$session</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$term_type</code><span class="initializer"> = &quot;vanilla&quot;</span></span>
   [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$env</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$width</code><span class="initializer"> = 80</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$height</code><span class="initializer"> = 25</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$width_height_type</code><span class="initializer"> = SSH2_TERM_UNIT_CHARS</span></span>
  ]]]]] ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   Open a shell at the remote end and allocate a stream for it.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ssh2-shell-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">session</code></dt>

     <dd>

      <p class="para">
       An SSH connection link identifier, obtained from a call to
       <span class="function"><a href="ssh2_connect.html" class="function">ssh2_connect()</a></span>.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">term_type</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">term_type</code> should correspond to one of the
       entries in the target system&#039;s <em>/etc/termcap</em> file.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">env</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">env</code> may be passed as an associative array of
       name/value pairs to set in the target environment.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">width</code></dt>

     <dd>

      <p class="para">
       Width of the virtual terminal.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">height</code></dt>

     <dd>

      <p class="para">
       Height of the virtual terminal.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">width_height_type</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">width_height_type</code> should be one of
       <strong><code>SSH2_TERM_UNIT_CHARS</code></strong> or
       <strong><code>SSH2_TERM_UNIT_PIXELS</code></strong>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ssh2-shell-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ssh2-shell-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5635">
    <p><strong>Example #1 Requesting an interactive shell</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$connection&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ssh2_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'shell.example.com'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">22</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">ssh2_auth_password</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'username'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'password'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$stream&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ssh2_shell</span><span style="color: #007700">(</span><span style="color: #0000BB">$connection</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'vt102'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">null</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">24</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SSH2_TERM_UNIT_CHARS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ssh2-shell-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ssh2_exec.html" class="function" rel="rdfs-seeAlso">ssh2_exec()</a> - Execute a command on a remote server</span></li>
    <li class="member"><span class="function"><a href="ssh2_tunnel.html" class="function" rel="rdfs-seeAlso">ssh2_tunnel()</a> - Open a tunnel through a remote server</span></li>
    <li class="member"><span class="function"><a href="ssh2_fetch_stream.html" class="function" rel="rdfs-seeAlso">ssh2_fetch_stream()</a> - Fetch an extended data stream</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>